{% if site.comment.provider == "disqus" %}
<!----------------- disqus ----------------->
<div class="comment">
  <div id="disqus_thread" class="disqus-thread"></div>
</div>

<script type="text/javascript">
  /* * * CONFIGURATION VARIABLES * * */
  var disqus_shortname = "{{site.comment.disqus_username}}";
  var disqus_identifier = "{{page.id}}";
  var disqus_url = "{{site.url}}{{page.url}}";

  (function() {
    var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
    dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";
    (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
  })();
</script>


{% elsif site.comment.provider == "gitalk" %}
<!----------------- Gitalk ----------------->
<div class="comment">
  <div id="gitalk-container"></div>
</div>

{%- assign _admin_list = "" -%}
{%- for _admin in site.comment.gitalk.admin -%}
{%- assign _admin_list = _admin_list | append: ", '" | append: _admin | append: "'" -%}
{%- endfor -%}
{%- assign _last = _admin_list | size | minus: 1 -%}
{%- assign _admin_list = _admin_list | slice: 2, _last -%}

<script type="text/javascript">
  var gitalk = new Gitalk({
    clientID: "{{ site.comment.gitalk.clientID }}",
    clientSecret: "{{ site.comment.gitalk.clientSecret }}",
    repo: "{{ site.comment.gitalk.repo }}",
    owner: "{{ site.comment.gitalk.owner }}",
    admin: [{{ _admin_list }}],
    id: md5(location.pathname),
    distractionFreeMode: false
  });
  gitalk.render("gitalk-container");
</script>


{% elsif site.comment.provider == "valine" %}
<!----------------- Valine ----------------->
<div class="comment">
  <div id="valine-container"></div>
</div>

<script type="text/javascript">
  new Valine({
    el: "#valine-container",
    appId: "{{site.comment.valine.appID}}",
    appKey: "{{site.comment.valine.appKey}}"
  })
</script>
{% endif %}
